<style>
    .sp_sign{
        color: grey;
        display: block;
    }
    .sp_red{
        color: red;
        display: block;
    }
</style>
<form class="layui-form layui-box" style='padding:25px 30px 20px 0' action="{:request()->url()}" data-auto="true" method="post">

    <div class="layui-form-item">
        <label class="layui-form-label">所属表</label>
        <div class="layui-input-block">
            <select name="tablename" required="required">
                <option value="">请选择</option>
                {notempty name='$tables_info'}
                {volist name='$tables_info' id='to'}
                <option value="{$to.tablename}" {:isset($vo.tablename)&&$vo.tablename==$to.tablename?'selected':''}>{$to.title}-{$to.tablename}</option>
                {/volist}
                {/notempty}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">字段注释</label>
        <div class="layui-input-block">
            <input type="text" name="title" value='{$vo.title|default=""}' class="layui-input" placeholder="填写字段注释 " required="required">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">英文字段名</label>
        <div class="layui-input-block">
            <input type="text" name="fields_name" value='{$vo.fields_name|default=""}' class="layui-input" placeholder="填写英文字段名 " required="required">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">字段类型</label>
        <div class="layui-input-block">
            <select name="type" <?php $fileds_type = getFieldsType('',true);?>  required="required">
                {volist name='fileds_type' id='v'}
                <option value="{$v}" {:isset($vo.type)&&$vo.type==$v?'selected':''}>{$v}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">长度</label>
        <div class="layui-input-block">
            <input type="text" name="size" value='{$vo.size|default=""}' class="layui-input" placeholder="填写长度 ">
            <span class="sp_sign">时间类型无需填写</span>
            <span class="sp_sign">大文本类型无需填写</span>
            <span class="sp_sign">枚举类型无需填写</span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">小数位</label>
        <div class="layui-input-block">
            <input type="number" name="decimals_size" value='{$vo.decimals_size|default="0"}' class="layui-input" placeholder="填写小数位数 ">
            <span class="sp_sign">时间类型无需填写</span>
            <span class="sp_sign">文本类型无需填写</span>
            <span class="sp_sign">枚举类型无需填写</span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">符号</label>
        <div class="layui-input-block">
            <select name="is_unsigned">
                <option value="0" {:isset($vo.type)&&$vo.type==0?'selected':''}>无</option>
                <option value="1" {:isset($vo.type)&&$vo.type==1?'selected':''}>有</option>
            </select>
            <span class="sp_sign">时间类型无需填写</span>
            <span class="sp_sign">文本类型无需填写</span>
            <span class="sp_sign">枚举类型无需填写</span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">默认值</label>
        <div class="layui-input-block">
            <input type="text" name="default" value="{$vo.default|default=''}" class="layui-input">
            <span class="sp_sign">时间类型无需填写</span>
            <span class="sp_sign">大文本类型无需填写</span>
            <span class="sp_sign">枚举类型默认值必须</span>
            <span class="sp_red">为避免错误，枚举类型请按例子填写->如: 支付状态:0=待支付,1=已支付;默认值则填写为: '0','1'</span>
        </div>
    </div>


    <div class="hr-line-dashed"></div>

    <div class="layui-form-item text-center">
        {if isset($vo['id'])}<input type='hidden' value='{$vo.id}' name='id'>{/if}
        <input type='hidden' value='{:isset($vo.fields_name)?$vo.fields_name:""}' name='old_fields_name'>
        <button class="layui-btn" type='submit'>保存</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close="">取 消</button>
    </div>
    <script>window.form.render();</script>
</form>
